#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
void *func(void *arg) {
sleep(2);
printf("Hello world!\n");
sleep(2);
return NULL;
}
int main(void) {
pthread_t tid;
if (pthread_create(&tid,NULL,func,NULL)) {
printf("Error creating thread.");
abort();
}
if (pthread_join(tid,NULL)) {
printf("Error joining thread.");
abort();
}
exit(0);
}
